/**
 * Created by Administrator on 2017/7/26.
 */
angular.module('module.originator_audit',[])

    .config(['$stateProvider',function ($stateProvider) {
        $stateProvider
            .state('home.originator_audit',{
                url:'/originator_audit',
                params:{originatorId:null},
                templateUrl:'view/originator_audit.html',
                controller:'originator_audit_controller'
            })
    }])

    .controller('originator_audit_controller',['$scope','$stateParams','OriginatorService',function ($scope,$stateParams,OriginatorService) {
        console.log('originator_audit_controller启动成功');
        console.log("$stateParams",$stateParams);
        var query_terms={
            originatorId:$stateParams.originatorId
        };

        function getOriginator() {
            OriginatorService.getOriginator(query_terms.originatorId,function (data) {
                console.log(data);
                $scope.originator=data;
            });
        }

        $scope.audit=function (originatorState) {
            $scope.originator.originatorState=originatorState;
            OriginatorService.updateOriginator($scope.originator,function () {
                console.log("成功")
            },function () {
                console.log("失败")
            })
        };

        getOriginator();

    }]);